home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
c
/
pro14
/
bm.man
< prev
next >
Wrap
Text File
|
1986-04-02
|
4KB
|
133 lines
BBBBMMMM((((PPPPUUUUBBBBLLLLIIIICCCC)))) XXXXEEEENNNNIIIIXXXX 3333....0000 ((((22221111 JJJJuuuunnnneeee 1111999988885555)))) BBBBMMMM((((PPPPUUUUBBBBLLLLIIIICCCC))))
NNNNAAAAMMMMEEEE
bm - search a file for a string
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
ppppuuuubbbblllliiiicccc bbbbmmmm [ option ] ... [ strings ] [ file ]
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_B_m searches the input _f_i_l_e_s (standard input default) for
lines matching a string. Normally, each line found is
copied to the standard output. It is blindingly fast. _B_m
strings are fixed sequences of characters: there are no
wildcards, repetitions, or other features of regular
expressions. Bm is also case sensitive. The following
options are recognized.
----xxxx (Exact) only lines matched in their entirety are
printed
----llll The names of files with matching lines are listed
(once) separated by newlines.
----cccc Only a count of the number of matches is printed
----nnnn Each line is preceded by the number of characters from
the beginning of the file to the match.
----ssss Silent mode. Nothing is printed (except error
messages). This is useful for checking the error
status.
----ffff _f_i_l_e
The string list is taken from the _f_i_l_e.
In all cases the file name is shown if there is more than
one input file. Care should be taken when using the
characters $ * [ ^ | ( ) and \ in the _s_t_r_i_n_g_s (listed on the
command line) as they are also meaningful to the Shell. It
is safest to enclose the entire _e_x_p_r_e_s_s_i_o_n argument in
single quotes ' '.
_B_m searches for lines that contain one of the (newline-
separated) _s_t_r_i_n_g_s, using the Boyer-Moore algorithm. It is
far superior in terms of speed to the grep (egrep, fgrep)
family of pattern matchers for fixed-pattern searching, and
its speed increases with pattern length.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
grep(1)
DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
Exit status is 0 if any matches are found, 1 if none, 2 for
syntax errors or inaccessible files.
Page 1 (printed 3/18/86)
BBBBMMMM((((PPPPUUUUBBBBLLLLIIIICCCC)))) XXXXEEEENNNNIIIIXXXX 3333....0000 ((((22221111 JJJJuuuunnnneeee 1111999988885555)))) BBBBMMMM((((PPPPUUUUBBBBLLLLIIIICCCC))))
AAAAUUUUTTTTHHHHOOOORRRR
Peter Bain (pdbain@wateng)
BBBBUUUUGGGGSSSS
Only 100 patterns are allowed.
Patterns may not contain newlines.
If a line (delimited by newlines, and the beginning and end
of the file) is longer than 8000 charcters (e.g. in a core
dump), it will not be completely printed.
Successive matches of different patterns may appear out of
order.
A line will be printed once for each different string on
that line.
The algorithm cannot count lines.
Page 2 (printed 3/18/86)